package file.day9_30;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入用户名：");
        String username = scanner.nextLine();

        System.out.println("请输入密码：");
        String password = scanner.nextLine();

        System.out.println("请输入昵称：");
        String nickname = scanner.nextLine();

        System.out.println("请输入年龄：");
        int age = scanner.nextInt();

        User u = new User(username,password,nickname,age);

        FileOutputStream fos = new FileOutputStream(u.getUsername()+".obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(u);
        oos.close();

    }
}
